<?php

App::import('Helper', 'Helper', false);

/**
 * This is a placeholder class.
 * Create the same file in app/app_helper.php
 *
 * Add your application-wide methods in the class below, your helpers
 * will inherit them.
 *
 * @package       cake
 * @subpackage    cake.cake
 */
class AppHelper extends Helper
{

    var $helpers = array('Session', 'Time');

    /**
     *
     * @param String $controller The name of controller
     * @param array $actions The name of actions
     * @return Boolean
     */
    function isActive($controller, $actions = array())
    {
        foreach($actions as $action)
        {
            if( $controller == $this->params['controller'] && $action == '*' )
            {
                return true;
            }
            if( $controller == $this->params['controller'] && $action == $this->params['action'] )
            {
                return true;
            }
        }
        return false;
    }

    /**
     * Checks if the current tab/url is Active or not
     *
     * @param String $controller The name of controller
     * @param String $actions The name of action
     * @return Mixed If success otherwise returns false
     */
    function isActiveTab($controller, $actions)
    {
        if( $this->isActive($controller, $actions) )
        {
            return "class = 'active'";
        }
        return false;
    }

}
